﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Hangfire;

namespace RafikiSIS_Site.Libraries
{
    public class HangFireAuthorizationFilter : Hangfire.Dashboard.IAuthorizationFilter
    {
        public bool Authorize(IDictionary<string, object> owinEnvironment)
        {
            // In case you need an OWIN context, use the next line,
            // `OwinContext` class is the part of the `Microsoft.Owin` package.
            var context = new OwinContext(owinEnvironment);

            if ("jstocksdale,tchase".Contains(context.Authentication.User.Identity.Name))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}